<!DOCTYPE html>
<html>

<head>
    <!-- 声明文档使用的字符编码 -->
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <!-- 为移动设备添加 viewport -->
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
    <!-- 针对手持设备优化，主要是针对一些老的不识别viewport的浏览器，比如黑莓 -->
    <meta name="HandheldFriendly" content="true">
    <!-- 优先使用 IE 最新版本和 Chrome -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <title>黑图视界</title>
    <meta name="keywords" content="黑图视界">
    <meta name="description" content="黑图视界">
    <script type="text/javascript" src="../js/setFontSize.js"></script>
    <script type="text/javascript" src="../js/getParameter.js"></script>
    <script type="text/javascript" src="../js/vue.js"></script>
    <script type="text/javascript" src="../js/axios.js"></script>
    <link rel="stylesheet" href="../css/swiper.min.css" />
    <link rel="stylesheet" href="../css/main.css" />
</head>
<style>
    #div1{
        border:2px solid #1e9fff;
    }
</style>
<body>
<div id="app">
    <main>
        <section class="profileItem whiteBg">
            修改内容:<input type="text" class="formInput" v-model="msg" style="width: 100%;height: 100px" placeholder="留下你的亮评。"/>
        </section>
        <main class="pab120">
            <div class="asideBox">
                <div class="container">
                    <a class="asideBtn" @click="updateContent()" href="#">修改</a>
                </div>
            </div>
        </main>
    </main>
</div>
<script type="text/javascript" src="../js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="../js/swiper.min.js"></script>
<script type="text/javascript" src="../js/layer/layer.js" ></script>
<script type="text/javascript" src="../js/main.js"></script>
<script src="../js/vue.js"></script>
<script src="../js/getParameter.js"></script>
<script src="../js/axios.js"></script>
<script>
    let app=new Vue({
        el:"#app",
        data:{
            content:{},
            msg:""
        },
        methods:{
            load(){
                let _this=this;
                let gid=getParameter("gid");
                console.log(gid);
                let aid=getParameter("aid");
                if(gid===null){
                    axios.get("/content/findACOne",{params:{cid:getParameter("cid")}}).then(function (response){
                        _this.content=response.data;
                        _this.msg=_this.content.msg;
                    })
                }else {
                    axios.get("/content/findOne",{params:{cid:getParameter("cid")}}).then(function (response){
                        _this.content=response.data;
                        _this.msg=_this.content.content;
                    })
                }

            },
            updateContent(){
                let _this=this;
                let gid=getParameter("gid");
                let aid=getParameter("aid");
                if(gid===null){
                    _this.content.msg=_this.msg;
                    axios.post("/content/updateACContent",_this.content).then(function (reponse){
                        location.href="/userclient/yudingDe.html?id="+aid;
                    })
                }else {
                    _this.content.content=_this.msg;
                    axios.post("/content/updateContent",_this.content).then(function (reponse){
                        location.href="/userclient/profile.html?gid="+getParameter("gid");
                    })
                }

            }
        },
        created(){
            this.load();
        }
    })
</script>
</body>

</html>